import {Dao, newSuccess, newFail} from 'yvan-server'

export function serverPing() {
    return {
        success: true,
        data: "OK"
    }
}

export function getDemoData(d) {
    console.log('==> {}', d)
    return {
        success: true,
        data: [
            {id: '110000', text: '北京市'},
            {id: '120000', text: '天津'},
            {id: '130000', text: '河北'},
            {id: '140000', text: '山西'},
            {id: '150000', text: '内蒙'},
        ]
    }
}

export function getDemoData2(d) {
    console.log('==> {}', d)
    return {
        success: true,
        data: [
            {value: '00A', label: 'label-A'},
            {value: '00B', label: 'label-B'},
            {value: '00C', label: 'label-C'},
            {value: '00D', label: 'label-D'},
            {value: '00E', label: 'label-E'},
        ]
    }
}


export function getCustomerData(a: any): Model<any[]> {
    const query = Application.getHttpRequest().getQueryParam();
    const customer = Dao.selectListAny("Root.getCustomerData", query.toDaoParam());
    return newSuccess(query.pageDb, customer);

}